package histogram;

import org.encog.neural.data.NeuralData;
import org.encog.neural.data.basic.BasicNeuralData;
import org.encog.neural.networks.BasicNetwork;

public class AbstractNeiro {

	double samples[][];
	double answers[][];
	
	public final String NET_NAME = "network";
	
	String log = new String();
	
	BasicNetwork network;
	
	public void setData(INeiroIO preparedData) {
		samples = preparedData.getSamples();
		answers = preparedData.getAnswers();
	}
	
	public String getLog(){
		return log;
	}
	
	public double[][] getAnswers() {
		return answers;
	}
	
	public double[][] getSamples() {
		return samples;
	}
	
	public double[][] computeTest(double[][] tests, int answDim){
		double res[][] = new double[tests.length][answDim];
		for (int i=0;i<tests.length;i++) {
			final NeuralData outputTmp = network
					.compute(new BasicNeuralData(tests[i]));

			double actual[] = outputTmp.getData();
			
			for (int j = 0; j < actual.length; j++) {
				res[i][j] = actual[j];
			}
		}
		return res;
	}
}
